<template>
  <div class="app-container">
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item label="VIP类型名称">
        <el-input v-model="listQuery.name"/>
      </el-form-item>
      <el-form-item label="禁/启用" >
          <el-select v-model="listQuery.isEnable" placeholder="请选择" clearable>
            <el-option
              v-for="item in isEnableList"
              :label="item.isUse"
              :value="item.value"
              :key="item.value"
            ></el-option>
          </el-select>
        </el-form-item>

        <!-- <el-form-item label="VIP优惠券类型" >
          <el-select placeholder="请选择" clearable>
            <el-option
              v-for="item in isUseList"
              :label="item.isUse"
              :value="item.value"
              :key="item.value"
            ></el-option>
          </el-select>
        </el-form-item> -->

      <el-button type="primary" @click="getList(1)">搜索</el-button>
      <el-button type="primary" >新增</el-button>
    </el-form>
    <mytable :data="list" ref="table" @getList="getList" :listQuery="listQuery">
      <el-table-column prop="name" align="center" label="VIP类型名称" width="150px"></el-table-column>
      <el-table-column prop="type" align="center" label="VIP优惠券类型" width="150px"></el-table-column>
      <el-table-column prop="firstOpenPrice" align="center" label="首开价格"></el-table-column>
      <el-table-column prop="continuPrice" align="center" label="连续购买价格"></el-table-column>
      <el-table-column prop="discount" align="center" label="折扣"></el-table-column>
      <el-table-column prop="monthsNum" align="center" label="时效(单位:月)"></el-table-column>
      <el-table-column prop="isEnable" align="center" label="是否启用"></el-table-column>
      <el-table-column prop="isRecommend" align="center" label="是否推荐"></el-table-column>
      <el-table-column prop="createUserId"  align="center" label="创建人ID"  width="200px"></el-table-column>
      <el-table-column prop="createTime" align="center" label="创建时间" width="200px"></el-table-column>
      <el-table-column  align="center" label="操作" width="250px">
          <template slot-scope="scope">
         <el-button type="text" @click="seePharmacy(scope.row)">查看已开通药店</el-button>
          <el-button type="text" @click="openEdit(scope.row)">修改</el-button>
          <el-button type="text" style="color:#f00" @click="opendel(scope.row)">删除</el-button>
          </template>
      </el-table-column>
      <el-table-column align="center" label="禁/启用"></el-table-column>
    </mytable>
    <dialogSeePharmacy ref="dialogSeePharmacy" />
  </div>
</template>

<script>
import apivipAccountManage from "@/api/accountManage/vipAccountManage";
import mytable from "@/components/Table";
import dialogSeePharmacy from './dialogSeePharmacy'
export default {
  name: "vipAccountManage",
  components: { mytable ,dialogSeePharmacy },
  data() {
    return {
      list: [],
      listQuery: {
        name: "", //vip类型名称
        isEnable:"",
      },
      listLoading: true,
      isEnableList:apivipAccountManage.isEnableList
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList(pageNo) {
      this.listQuery.pageNo = pageNo || this.listQuery.pageNo;
      apivipAccountManage.query(this.listQuery).then(res => {
        this.$refs.table.load(res.data.page.list, res.data.page.total);
      });
    },
    //查看已开通药店
    seePharmacy(row){
        this.$refs.dialogSeePharmacy.seePharmacy(row)
    },
    //修改
    editMenu(row){
        this.$refs.dialogSeePharmacy.editMenu(row)
    }
  }
};
</script>

<style scoped>
</style>